<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Vue 组件通信</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <v-button></v-button>
</div>
<script>
    Vue.component('v-button', {
        template: '<button @click="alertText">添加</button>',
        methods: {
            alertText() {
                alert('点击了添加按钮')
            }
        }
    })
    var app = new Vue({
        el: '#app'
    })
</script>
</body>
</html>